<?php
class Admin_PermissionController extends Zend_Controller_Action
{

	public function init(){
		$registry = Zend_Registry::getInstance();
		$this->_db = $registry->get('db');
	}
	
	public function indexAction()
	{
		Zend_Loader::loadFile('../application/admin/models/User.php');
		$user_model = new User();
		$request = $this->getRequest();
		$usertype = $request->getParam('usertype');
		$user_permission = $user_model->getUserPermission();
		$this->view->user_permission = $user_permission;
	}
	
	public function editAction()
	{
		Zend_Loader::loadFile('../application/admin/models/Permission.php');
		Zend_Loader::loadFile('../application/admin/models/User.php');
		//$this->_helper->layout->setLayout('admin');
		$mod_permission = new Permission();
		$mod_user = new User();
		$request = $this->getRequest();
		$type = $request->getParam('type');
		$get_permission = $mod_permission->getPermission($type);
		$get_modules = $mod_user->getModules();
		$this->view->type = $type;
		$this->view->permission = $get_permission;
		$this->view->get_modules = $get_modules;
	}
}